package com.y.architecture.login;

import com.y.architecture.base_net.ApiCallback;
import com.y.architecture.base_net.BaseNetService;
import com.y.architecture.bean.User;

import rx.Observable;

/**
 * Created by youjingjing on 2017/12/21.
 */

public class LoginService extends BaseNetService {
    private static LoginService loginService;

    public static LoginService getInstance() {
        if (loginService == null) {
            synchronized (LoginService.class){
                if (loginService == null) {
                    loginService = new LoginService();
                }
            }
        }
        return loginService;
    }

    public void getData(String username, String password, int port, String host,ApiCallback<User> callback) {
        LoginApi loginApi = LoginNet.getInstance().getmDefaultApi();
        Observable<User> user = loginApi.getUser(username);
        addCompositeSub(addScheduels(user).subscribe(callback));
    }
}
